<%
'******************************************************************************
' Copyright (C) 2006 Google Inc.
'  
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'  
'      http://www.apache.org/licenses/LICENSE-2.0
'  
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
'******************************************************************************
%>
<!-- #include file="../library/googleglobal.asp" -->
<%

Dim MyCart
Set MyCart = New Cart

' Add items
Dim MyItem

Set MyItem = New Item
MyItem.Name = "MegaSound 2GB MP3 Player" 
MyItem.Description = "Portable MP3 player - stores 500 songs"
MyItem.Quantity = 1
MyItem.UnitPrice = 178.00
MyItem.MerchantPrivateItemData = "<color>blue</color><weight>3.2</weight>"
MyCart.AddItem MyItem
Set MyItem = Nothing

Set MyItem = New Item
MyItem.Name = "Dry Food Pack AA1453" 
MyItem.Description = "A pack of highly nutritious dried food for emergency."
MyItem.Quantity = 1
MyItem.UnitPrice = 35.00
MyItem.MerchantItemId = "JMACC012"
MyItem.TaxTableSelector = "food"  ' Alternate tax table "food" defined below
MyCart.AddItem MyItem
Set MyItem = Nothing

' Set optional parameters
MyCart.CartExpiration = "2007-12-31T23:59:59"
MyCart.MerchantPrivateData = "<session-id>Session123</session-id><cart-id>Cart123</cart-id>"
' MyCart.MerchantCalculationsUrl = "https://www.example.com/callback.asp"
' MyCart.MerchantCalculatedTax = False
' MyCart.AcceptMerchantCoupons = True
' MyCart.AcceptGiftCertificates = True
MyCart.EditCartUrl = "http://www.example.com/edit"
MyCart.ContinueShoppingUrl = "http://www.example.com/continue"
MyCart.RequestBuyerPhoneNumber = True
MyCart.SetRoundingPolicy "CEILING", "TOTAL"
MyCart.RequestInitialAuthDetails = True


' Add shipping methods
' Note: You cannot mix merchant-calculated-shipping methods with other shipping 
' methods (flat-rate-shipping or pickup) in the same cart.
Dim MyShipping, MyShippingRestrictions, MyAddressFilters

' Add a flat-rate-shipping method
Set MyShipping = New FlatRateShipping
MyShipping.Name = "UPS Ground"
MyShipping.Price = 5.00
' Set shipping restrictions
Set MyShippingRestrictions = New ShippingFilters
MyShippingRestrictions.AllowedCountryArea = "CONTINENTAL_48"
MyShipping.AddShippingRestrictions MyShippingRestrictions
Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
MyCart.AddShipping MyShipping
Set MyShipping = Nothing

' Add a flat-rate-shipping method
' Set MyShipping = New FlatRateShipping
' MyShipping.Name = "UPS Next Day"
' MyShipping.Price = 10.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowedStates = Array("CA", "AZ", "OR", "WA")
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add an international flat-rate-shipping method
Set MyShipping = New FlatRateShipping
MyShipping.Name = "FedEx 2nd Day"
MyShipping.Price = 15.00
' Set shipping restrictions
Set MyShippingRestrictions = New ShippingFilters
MyShippingRestrictions.AddAllowedPostalArea "GB", "SW*"
MyShippingRestrictions.AddAllowedPostalArea "DE", ""
MyShippingRestrictions.AddAllowedPostalArea "FR", ""
MyShipping.AddShippingRestrictions MyShippingRestrictions
Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
MyCart.AddShipping MyShipping
Set MyShipping = Nothing

' Add an international flat-rate-shipping method
' Set MyShipping = New FlatRateShipping
' MyShipping.Name = "FedEx Next Day"
' MyShipping.Price = 30.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowedWorldArea = True
' MyShippingRestrictions.AllowUsPoBox = False
' MyShippingRestrictions.AddExcludedPostalArea "GB", "SW*"
' MyShippingRestrictions.AddExcludedPostalArea "FR", ""
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add a merchant-calculated-shipping method
' Set MyShipping = New MerchantCalculatedShipping
' MyShipping.Name = "UPS Ground"
' MyShipping.Price = 5.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowedStates = Array("CA", "NY", "DC", "NC")
' MyShippingRestrictions.AllowedZipPatterns = Array("9404*", "94086", "91801", "91362")
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add a merchant-calculated-shipping method
' Set MyShipping = New MerchantCalculatedShipping
' MyShipping.Name = "UPS Next Day"
' MyShipping.Price = 10.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowedZipPatterns = Array("9404*", "94086", "91801", "91362")
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add an international merchant-calculated-shipping method
' Set MyShipping = New MerchantCalculatedShipping
' MyShipping.Name = "FedEx 2nd Day"
' MyShipping.Price = 15.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowUsPoBox = False
' MyShippingRestrictions.AddAllowedPostalArea "GB", "SW*"
' MyShippingRestrictions.AddAllowedPostalArea "DE", ""
' MyShippingRestrictions.AddAllowedPostalArea "FR", ""
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Set address filters
' Set MyAddressFilters = New ShippingFilters
' MyAddressFilters.AllowUsPoBox = False
' MyAddressFilters.AddAllowedPostalArea "GB", "SW*"
' MyShipping.AddAddressFilters MyAddressFilters
' Set MyAddressFilters = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add an international merchant-calculated-shipping method
' Set MyShipping = New MerchantCalculatedShipping
' MyShipping.Name = "FedEx Next Day"
' MyShipping.Price = 30.00
' Set shipping restrictions
' Set MyShippingRestrictions = New ShippingFilters
' MyShippingRestrictions.AllowedWorldArea = True
' MyShippingRestrictions.AllowUsPoBox = False
' MyShippingRestrictions.AddExcludedPostalArea "US", ""
' MyShipping.AddShippingRestrictions MyShippingRestrictions
' Set MyShippingRestrictions = Nothing
' Set address filters
' Set MyAddressFilters = New ShippingFilters
' MyAddressFilters.AllowUsPoBox = False
' MyAddressFilters.AddExcludedPostalArea "US", ""
' MyShipping.AddAddressFilters MyAddressFilters
' Set MyAddressFilters = Nothing
' Add the shipping to the cart
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing

' Add <pickup> method
' Set MyShipping = New PickupShipping
' MyShipping.Name = "PICK-UP"
' MyShipping.Price = 0
' MyCart.AddShipping MyShipping
' Set MyShipping = Nothing


' Define default tax rules
Dim MyDefaultTaxRule

'Add US default tax rule
Set MyDefaultTaxRule = New DefaultTaxRule
MyDefaultTaxRule.Rate = 0.0825
MyDefaultTaxRule.States = Array("CA", "NY")
MyCart.AddDefaultTaxRule(MyDefaultTaxRule)
Set MyDefaultTaxRule = Nothing

' Set MyDefaultTaxRule = New DefaultTaxRule
' MyDefaultTaxRule.Rate = 0.0750
' MyDefaultTaxRule.CountryArea = "ALL"
' MyCart.AddDefaultTaxRule(MyDefaultTaxRule)
' Set MyDefaultTaxRule = Nothing

' Add international default tax rule
Set MyDefaultTaxRule = New DefaultTaxRule
MyDefaultTaxRule.Rate = 0.15
MyDefaultTaxRule.AddPostalArea "GB", ""
MyCart.AddDefaultTaxRule(MyDefaultTaxRule)
Set MyDefaultTaxRule = Nothing

' Set MyDefaultTaxRule = New DefaultTaxRule
' MyDefaultTaxRule.Rate = 0.10
' MyDefaultTaxRule.WorldArea = True
' MyCart.AddDefaultTaxRule(MyDefaultTaxRule)
' Set MyDefaultTaxRule = Nothing

' Define an alternate tax table
Dim MyAlternateTaxTable, MyAlternateTaxRule

Set MyAlternateTaxTable = New AlternateTaxTable
MyAlternateTaxTable.Name = "food"
MyAlternateTaxTable.Standalone = False

' Define alternate tax rules for the "food" alternate tax table
Set MyAlternateTaxRule = New AlternateTaxRule
MyAlternateTaxRule.Rate = 0.05
MyAlternateTaxRule.AddPostalArea "GB", ""
MyAlternateTaxRule.AddPostalArea "DE", ""
MyAlternateTaxRule.AddPostalArea "FR", ""
MyAlternateTaxRule.States = Array("CA", "NY")
MyAlternateTaxTable.AddTaxRule(MyAlternateTaxRule)
Set MyAlternateTaxRule = Nothing

' another alternate-tax-rule
' Set MyAlternateTaxRule = New AlternateTaxRule
' MyAlternateTaxRule.Rate = 0.03
' MyAlternateTaxRule.AddPostalArea "GB", "SW*"
' MyAlternateTaxRule.CountryArea = "FULL_50_STATES"
' MyAlternateTaxTable.AddTaxRule(MyAlternateTaxRule)
' Set MyAlternateTaxRule = Nothing

' Add the alternate-tax-table to the cart
MyCart.AddAlternateTaxTable(MyAlternateTaxTable)
Set MyAlternateTaxTable = Nothing


' Add another alternate-tax-table to the cart
' Set MyAlternateTaxTable = New AlternateTaxTable
' MyAlternateTaxTable.Name = "drug"
' MyAlternateTaxTable.Standalone = False

' Add a alternate-tax-rule
' Set MyAlternateTaxRule = New AlternateTaxRule
' MyAlternateTaxRule.Rate = 0.03
' MyAlternateTaxRule.AddPostalArea "GB", ""
' MyAlternateTaxRule.AddPostalArea "DE", ""
' MyAlternateTaxRule.AddPostalArea "FR", ""
' MyAlternateTaxRule.ZipPatterns = Array("9404*", "1002*")
' MyAlternateTaxTable.AddTaxRule(MyAlternateTaxRule)
' Set MyAlternateTaxRule = Nothing

' Add another alternate-tax-rule
' Set MyAlternateTaxRule = New AlternateTaxRule
' MyAlternateTaxRule.Rate = 0.02
' MyAlternateTaxRule.AddPostalArea "GB", "SW*"
' MyAlternateTaxRule.States = Array("CA", "NY", "WA")
' MyAlternateTaxTable.AddTaxRule(MyAlternateTaxRule)
' Set MyAlternateTaxRule = Nothing

' Add the alternate-tax-table to the cart
' MyCart.AddAlternateTaxTable(MyAlternateTaxTable)
' Set MyAlternateTaxTable = Nothing


' Add parameterized-url
' Dim MyParameterizedUrl
' Set MyParameterizedUrl = New ParameterizedUrl
' MyParameterizedUrl.Url = "http://www.example.com/tracking?partner=12345&amp;partnerName=Bob&apos;s%20Big%20Stores"
' MyParameterizedUrl.AddUrlParameter "orderID", "order-id"
' MyParameterizedUrl.AddUrlParameter "totalCost", "order-total"
' MyParameterizedUrl.AddUrlParameter "taxes", "tax-amount"
' MyParameterizedUrl.AddUrlParameter "shipping", "shipping-amount"
' MyCart.AddParameterizedUrl MyParameterizedUrl
' Set MyParameterizedUrl = Nothing

' Retrieve Google Analytics data
' MyCart.AnalyticsData = Request.Form("analyticsdata")

' Display <checkout-shopping-cart> XML
' Response.Write MyCart.GetXml

' Diagnose <checkout-shopping-cart> XML
' MyCart.DiagnoseXml

' Post Cart to Google Checkout 
MyCart.PostCartToGoogle

Set MyCart = Nothing

%>